<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
 
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="viewport" content="initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <title>登录</title>
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="iconfont/iconfont.css">
    <link rel="stylesheet" href="css/login.css">
    <script src="https://cdn.bootcss.com/jquery/1.9.1/jquery.min.js"></script>
    <!--  layer  -->
    <script src="https://cdn.bootcss.com/layer/3.0.3/layer.min.js"></script>
    <link href="https://cdn.bootcss.com/layer/3.0.3/mobile/need/layer.min.css" rel="stylesheet">
    <!--  md5  -->
    <script src="js/library/md5.min.js"></script>
    <!--  api  -->
    <script src="js/api.js"></script>
    <script src="js/library/scroll.min.js"></script>
  	<script src="js/com.js"></script>

  
</head>
<style>

</style>

<body style="overflow: hidden">
    <div class="dk-body-bg">
        <div class="dk-login-box border-r6"> <img src="images/logo.png" alt="" class="dk-form-logo" />
            <div class="dk-login-title">
                <h2>登录</h2>
                <p>[ 找大咖 ] 帮您调程序</p> <img src="images/login-erweima.png"> </div>
            <form id="login-form" method="post">
                <div class="dk-form-group">
                    <label><i class="iconfont">&#xe600;</i></label>
                    <input type="text" placeholder="手机号" class="login-input dk-full-input" id="login-mobile" name=""> <span></span></div>
                <div class="dk-form-group">
                    <label><i class="iconfont">&#xe605;</i></label>
                    <input type="password" placeholder="请输入密码" class="login-input dk-full-input" id="login-pwd" name=""> <span></span></div>
                <div class="dk-form-group border-clear">
                    <button type="button" class="bg-blue dk-default-btn" id="dk-login-btn">登录</button>
                </div>
                <div class="clearfix"> <span class="fl fc-black1">没有账号？现在<a href="reg.html"class="fc-blue fs-h2">注册</a></span> <a href="#" class="fr fc-black1" id="findpwd-way">忘记密码？</a> </div>
            </form>
        </div>
    </div>
</body>
<!--  找回密码  -->
<div id="findpwd-box">
    <div class="dk-login-title">
        <h2 class="txt-c">找回密码</h2></div>
    <form method="post">
        <div class="dk-form-group">
            <input type="text" placeholder="手机号" class="dk-full-input" id="f-mobile" name=""> </div>
        <div class="dk-form-group">
            <input type="text" placeholder="请输入验证码" class="dk-full-input" id="f-vail" name="">
            <input type="button" class="dk-getCode bg-blue border-r6" value="获取验证码"> </div>
        <!--<div class="dk-form-group">
            <input type="password" placeholder="旧密码" class="dk-full-input" id="oldpwd" name=""><span></span> </div>-->
        <div class="dk-form-group">
            <input type="password" placeholder="请设置密码为6~16位，必须有数字和字母" class="dk-full-input" id="f-pwd1" name=""><span></span> </div>
        <div class="dk-form-group">
            <input type="password" placeholder="请重复输入密码" class="dk-full-input" id="f-pwd2" name=""><span></span> </div>
        <div class="dk-form-group border-clear">
            <button type="button" class="bg-blue dk-default-btn" id="dk-finish-btn">完成</button>
        </div>
    </form>
</div>

<script>
    $('#findpwd-way').on('click', function () {
        layer.open({
            type: 1
            , title: false
            , area: ['360px', 'auto']
            , shade: [0.8, '#fff']
            , shadeClose: true
            , content: $('#findpwd-box')
        });
    });
    //登录
    $("#dk-login-btn").click(function () {
        var mobile = $("#login-mobile").val();
        var pwd = $("#login-pwd").val();
    
        var data = {
            "username": mobile,
            "password": pwdmd5(pwd),
            "remember": 0
        };
        if (form_check('phone', "#login-mobile") && form_check('pwd', "#login-pwd")) {
            User.Post(User.login, data, function (obj) {
            	
                if (obj.code == "200") {
                    var user=obj.data;
                    msg(obj.msg,function(){
	                   	setCache('user_id',user.user_id);
	                    setCache('token',user.token);
	                    setCache('username',user.username);
	                    setCache('name',user.name);
	                    setCache('headpic',user.headpic);
	                    herf("./index.html");
                    })
                }
                else {
                    msg(obj.msg);
                }
            })
        }
    });
    //找回密码获取验证码
    $(".dk-getCode").click(function () {
        var fmobile = $("#f-mobile").val();
        var data = {
            'mobile': fmobile
            ,'type':2
        };
        if (form_check('phone', "#f-mobile")) {
            User.Post(User.sendcode, data, function (obj) {
                if (obj.code == "200") {
                    msg(obj.msg,function(){
                    		 settime(".dk-getCode", 60);
                    	})
                }
                else {
                   msg(obj.msg);
                }
            });
        }
    });
    $("#dk-finish-btn").click(function () {
        var a = $("#f-pwd1").val();
        var b = $("#f-pwd2").val();
        var fpwd = pwdmd5(a);
        var fpwd1 = pwdmd5(b);
       
        var fmobile = $("#f-mobile").val();
        var fvail = $("#f-vail").val();
        var oldpwd = $("#oldpwd").val();
        var data = {
            'username': fmobile
            , 'findcode': fvail
            , 'password': fpwd
            , 'repassword': fpwd1
        };
        if (form_check('phone', "#f-mobile") && form_check('pwd', "#f-pwd1") && pwdvali("#f-pwd2", "#f-pwd1")) {
            User.Post(User.findpwd, data, function (obj) {
                if (obj.code == "200") {
                   msg(obj.msg,function(){
	                   
	                  $(".layui-layer-close").click();
                    })
                }
                else {
                	msg(obj.msg)
                }
            });
        }
    })
</script>

</html>